package com.example.restaurant.dao;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.restaurant.controller.form.ModifyDishOperateForm;
import com.example.restaurant.model.DishOperate;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.restaurant.service.dto.AddDishOrderInfoDto;
import com.example.restaurant.service.dto.GetOrderOperateDto;
import com.example.restaurant.service.param.ModifyDishOperateParam;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * <p>
 * 加退菜表 Mapper 接口
 * </p>
 *
 * @author x
 * @since 2022-09-29
 */
public interface DishOperateMapper extends BaseMapper<DishOperate> {
    @Select("SELECT d.price,d.picture,dop.dish_id,dop.order_number,d.dish_type_name,dop.dish_number from dish_operate dop JOIN  dish d ON d.id=dop.dish_id where d.id=#{id}")
    IPage<GetOrderOperateDto> queryDishOperateByDishId(Page<GetOrderOperateDto> page,@Param("id") Integer id);
    @Update("update dish_operate set status=#{param.status},dish_number=#{param.dishNumber} where dish_id=#{param.dishId} and order_number=#{param.orderNumber}")
    int modifyDishOperateStatus(@Param("param") ModifyDishOperateParam param);
}
